import { get, post } from "@/utils/request";

/**
 * 事项列表
 */
export interface MatterItemRes {
    icon: string;
    name: string;
    uuid: string;
    online: 1 | 2;
    file_or_url: string;
}
export const getMatterItemApi = (params: {page: number; page_size:number; online?:number;name?:string}) => get<{items: MatterItemRes[]}>("/api/v1/item/list", {params});

export const getMatterDetailApi = (params:{uuid:string}) => get<{file_or_url:string;name:string;uuid:string;}>("/api/v1/item/detail", {params});

/**
 * 事项分类视图
 */
export const getMatterSortApi = (params:{by:'dept' | 'theme';category?:number;module?:1 | 2}) => get<{items: MatterItemRes[]}>("/api/v1/item/sort", {params});

/**
 * 新闻列表
 */
export interface NewsItemRes {
    cover: string;
    carousel: boolean;
    uuid: string;
}
export const getNewsItemApi = (params:{page:string;page_size:string;}) => get<{items: NewsItemRes[]}>("/api/v1/news/list", {params});

/**
 * 新闻详情
 */
export interface NewsShowInfoRes {
    cover: string;
    carousel: boolean;
    uuid: string;
    detail: string;
    title: string;
    add_datetime: string;
}
export const getNewsShowApi = (params:{uuid:string;}) => get<NewsShowInfoRes>("/api/v1/news/detail", {params});


/**
 * 群众根据发起url获取对应的所有客服
 */
export const getStaffItemApi = (params:{url:string}) => post("/api/v1/video/people-url-staff-info", params);

/**
 * 预约列表
 */
export const getAppointmentListApi = () => get("/api/v1/appointment/list");

/**
 * 预约
 */
export const postAppointmentApi = (params: {item:string;customer_service:string;date:string;category:string}) => post("/api/v1/appointment/create", params);


export const postSendFileApi = (params: {item:string;to_user:string;mobile:string;name:string;files:string[]}) => post("/api/v1/chat/send-file", params);





